from django.db import models

# Create your models here.
class Author(models.Model):
    name =  models.CharField(max_length=32,null = True , blank=True)
    email =  models.EmailField()
    def __str__(self):
        return '%s' % (self.name)
class Publisher(models.Model):
    name = models.CharField(max_length=64,null = True ,blank= True)
    city = models.CharField(max_length=64,null = True ,blank= True)
    country = models.CharField(max_length=64,null = True ,blank= True)
    def __str__(self):
        return '%s' % (self.name)
class Book(models.Model):
    name = models.CharField(max_length=64,null = True,blank=True)
    author = models.ManyToManyField(Author)
    publisher = models.ForeignKey(Publisher)
    publisher_date = models.DateTimeField(auto_now_add=True)
    def __str__(self):
        return '%s--%s' % (self.name,self.publisher_date)